<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>产品分类选择</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<script src="js/jquery-1.4.4.js" type="text/javascript"></script>
		<script type="text/javascript">
		function choose()
		{
			var producttable = parent.document.getElementById('${id}');
			//产品分类表格的行数
			var index = producttable.rows.length;
			var step = 0;
			var product = document.all.product;
			var rows = document.getElementById("list").rows;
			var choosed = false;
			var html = "";
			for(var i=0;i<product.length;i++)
			{		
				var item = product[i];		
				if(item.checked)
				{
					choosed = true;
					//添加新行的序列号
					var count = index-1+step;
					++step;
					var pk = item.value;
					var row = rows[i+1];
					var cells = row.cells;
					var name = cells[2].all.tags("input")[0].value;
					var row = producttable.insertRow(count);
					row.setAttribute("align","left");
					//row.setAttribute("class","datarow");
					var cell = row.insertCell();
					cell.innerHTML = count;
					
					cell = row.insertCell();
					cell.innerHTML = "<input name=\"qaname\" type=\"text\" class=\"textinput\" value="+name+" readOnly/><input name=\"qapk\" type=\"hidden\" class=\"textinput\" value="+pk+" />";
										
					cell = row.insertCell();
					cell.innerHTML = "<a href=\"javascript:deleterow("+count+",'${id}');\">删除</a>";
				}
			}
			if(choosed == false)
			{
				alert("请至少选择一条资质分类信息");
				return false;
			}else{
				hideMe();
			}
		}
	</script>
	</head>

	<body>
		<form>
			<p>
				<input type="button" value="确定" onclick="choose()" />
			</p>
			<table id="list">
				<tr>
					<td>
						操作
					</td>
					<td>
						序号
					</td>
					<td>
						资质分类名称
					</td>
				</tr>
				<c:if test="${list!=null}">
					<c:forEach items="${list}" var="item" varStatus="index">
						<tr>
							<td>
								<input type="checkbox" name="product"
									value="${item.pk_qualifitype}" />
							</td>
							<td>
								<input type="text" value="${index.count}" readOnly/>
							</td>
							<td>
								<input name="qaname" type="text" value="${item.qualifitype_name}" readOnly/>
							</td>
						</tr>
					</c:forEach>
				</c:if>
			</table>
		</form>
	</body>
</html>
